package org.com.db.exception;

import java.util.HashMap;
import java.util.Map;

public enum DBMSG {
	

	DB_ERROR001("AE-00001", "資料新增失敗"), //
	DB_ERROR002("AE-00002", "資料查詢失敗"),//
	DB_ERROR003("AE-00003", "資料修改失敗"),
	DB_ERROR000("AE-00000", "資料庫處理失敗")
	;
	final String code;
	final String content;

	final static Map<String, String> MAP;

	DBMSG(String code, String content) {
		this.code = code;
		this.content = content;
	}

	static {
		MAP = new HashMap<String, String>();

		for (DBMSG msg : DBMSG.values()) {
			MAP.put(msg.getCode(), msg.getContent());
		}

	}

	public static String content(String code) {
		return MAP.get(code);
	}

	public static String content(DBMSG msg) {

		return msg.getContent();

	}

	public String getCode() {
		return code;
	}

	public String getContent() {
		return content;
	}

}
